This invention relates to communication networks and more particularly to a method and apparatus for detecting and resolving collisions and noise corruption in a Universal Asynchronous Receiver Transmitter (UART) based peer to peer communication network.
Historically electrical and electronic functions in vehicles have been implemented with individual Electronic Control Units (ECU""s) which perform separate, independent functions. For example, a vehicle system might include one ECU for engine control functions, another ECU to perform anti-lock brake functions, and yet another ECU to control the instrument cluster. As vehicle electronic architectures have evolved, it has become necessary for ECU""s to communicate with each other in order to realize desirable vehicle system features such as the following:
1. Distributed vehicle functions via coordination between separate ECU""s;
2. Sharing of related data between ECU""s; and
3. Access to diagnostic data of multiple ECU""s via a single, common interface.
An example of the first feature would be a vehicle traction control system, which involves coordination between a powertrain controller and an Anti-Lock Brake System (ABS) controller. An example of the second feature would be communication of engine coolant temperature data from the powertrain ECU to the instrument cluster ECU for display by the instrument cluster. The third feature mentioned above allows a single diagnostic connection to a bus or network to access a multiplicity of modules for diagnostic information or to exercise diagnostic functions in a vehicle without having to connect to each ECU separately.
Communication between ECU""s in vehicles has been realized with a variety of solutions. Several CARRIER SENSE MULTIPLE ACCESS/COLLISION DETECT/ARBITRATE (CSMA/CD/A) protocols have been designed and are being used in vehicles, including the ISO9141 standard, otherwise known as Controller Area Network (CAN), and SAE J1850 standards, including the J1850 PWM and VPW implementations. These protocols must be implemented by custom integrated circuits which are designed specifically to adhere to the stated protocol. As arbitration based protocols, these protocols require message transmissions to synchronize to and arbitrate with each other on a bit by bit basis such that message collisions on the bus are not destructive to the dominant message. However, the fact that custom integrated circuits are required to implement these communication protocols implies an associated cost for the protocol controller.
An alternative to using custom integrated circuits is to use a UART (Universal Asynchronous Receiver Transmitter) to implement a peer to peer communication network between ECU""s, as shown in FIG. 1. The ECU""s used in vehicles are almost exclusively micro-controller based designs. The UART is a micro-controller peripheral which is widely available for a large variety of micro-controller families and is less complex and less costly than custom integrated solutions for CSMA/CD/A communication protocols. However, UARTs are most commonly used as solutions for point to point communication between ECU""s on a common network, where communication is coordinated by a single bus xe2x80x9cmasterxe2x80x9d on the network, with the remaining nodes acting as xe2x80x9cslavesxe2x80x9d.
Peer to peer communication networks are typically not implemented using UARTs, for the following reasons; 1.) UARTs are not able to synchronize to signals already present on the bus. When the UART is commanded to transmit a character, it transmits the character independent of what signal is on the bus. 2.) UARTs are not able to bit-wise arbitrate; once the UART begins transmission of a character, the character is completely transmitted. 3.) Collisions between multiple nodes transmitting on a UART based peer to peer communication network can result in distorted waveforms which cause data to be received and interpreted differently by different nodes on the bus.
The collision problem associated with prior art use of UARTs in peer to peer communication networks will be apparent from the following discussion with respect to FIG. 2. In this case, two nodes have initiated message transmissions asynchronously, with half a bit period of phase shift between them. The resulting waveform on the bus, which is a composite of the signals driven onto the bus by the two individual nodes, causes data transitions to occur exactly at the receiving UART sample points which have been projected from the first edge of the start bit. Data samples (circled arrows) taken during data transitions are undefined and result in correspondingly unreliable data messages. As UARTs are not capable of bit-wise arbitration, it is not possible to develop a CSMA/CD/A protocol using them.
In addition to the data collision problem, the vehicle environment is an extremely noisy electrical environment with respect to both radiated and conducted noise sources which further reduces the reliability and integrity of data transmissions.
In accordance with the present invention, a multiple ECU communication method is provided that utilizes micro-controller UARTs to achieve reliable peer to peer communication. The communication method utilizes a defined message format and a multiplicity of checks on the integrity of individual characters and on the integrity of the complete message relative to the defined message format to achieve reliable data transmission and reception between nodes. The method utilizes a software mechanism for generating a negative acknowledgment (NACK) signal which, in the event that message corruption is detected by any one node on the network, flags the message corruption and generates a signal which is guaranteed to corrupt the message in progress. This causes all receivers of the message in progress to cancel reception of a corrupted message and causes transmitters to retry transmission of the message. This negative acknowledgment technique takes advantage of the frame format checking inherent to UARTs by overwriting the stop bit of the UART character frame.
The method described herein is equally effective in detecting and rejecting corruption of messages in a UART based system which have been corrupted either due to data collisions by multiple transmitters on the network or due to noise corruption resulting from conducted or radiated noise sources. The noise rejected may either be global noise (detected by all receivers on the network) or local noise (detected by only one transmitter or receiver on the network). The method defined by this invention does not impose any limits on the number of nodes on the network and does not require any special data content other than a unique source address that is assigned to each node on the network.